import http from '@/http'
import { PageResponse } from '@/types'
import * as T from './types'

export const API_PRE = 'http://localhost:8080/xiaopeng'

/**
 * 菜单-列表查询
 */
export const selectMenuListApi = http.post<any, T.MenuRes[]>(`${API_PRE}/erp/basic/sysMenu/list`)

/**
 * 菜单-分页查询
 */
export const selectMenuPageApi = http.post<any, PageResponse<T.MenuRes>>(`${API_PRE}/erp/basic/sysMenu/page`)

/**
 * 菜单-详情
 */
export const queryDetailApi = http.get<{ menuId: number }, T.MenuDetailRes>(`${API_PRE}/erp/basic/sysMenu/detail`)

/**
 * 菜单-保存
 */
export const saveMenuApi = http.post<T.MenuEditParams>(`${API_PRE}/erp/basic/sysMenu/save`)

/**
 * 菜单-修改
 */
export const updateMenuApi = http.post<T.MenuEditParams>(`${API_PRE}/erp/basic/sysMenu/update`)

/**
 * 菜单-修改启用状态
 */
export const updateEnableStatusApi = http.post<T.MenuUpdateEnableStatusParams>(`${API_PRE}/erp/basic/sysMenu/update/enableStatus`)

/**
 * 菜单-删除
 */
export const deleteMenuApi = http.get<{ menuId: number }>(`${API_PRE}/erp/basic/sysMenu/delete`)

/**
 * 菜单-权限列表
 */
export const selectMenuPermissionListApi = http.get<{ menuId: number }>(`${API_PRE}/erp/basic/sysMenu/permission/list`)

/**
 * 菜单-权限保存
 */
export const saveMenuPermissionApi = http.post<T.MenuPermissionSaveReqDTO>(`${API_PRE}/erp/basic/sysMenu/permission/save`)